/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.upn.sigemfi.can.be;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Jhosep
 */
@Entity
@Table(name = "CAN_BANCO")
@NamedQueries({@NamedQuery(name = "Banco.findAll", query = "SELECT b FROM Banco b"), @NamedQuery(name = "Banco.findByIdBanco", query = "SELECT b FROM Banco b WHERE b.idBanco = :idBanco"), @NamedQuery(name = "Banco.findByNombreBanco", query = "SELECT b FROM Banco b WHERE b.nombreBanco = :nombreBanco"), @NamedQuery(name = "Banco.findByDescripcionBanco", query = "SELECT b FROM Banco b WHERE b.descripcionBanco = :descripcionBanco")})
public class Banco implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID_BANCO", nullable = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long idBanco;
    @Column(name = "NOMBRE_BANCO", length = 50)
    private String nombreBanco;
    @Column(name = "DESCRIPCION_BANCO", length = 250)
    private String descripcionBanco;
    @JoinColumn(name = "FID_CAN_CIUDAD", referencedColumnName = "ID_CIUDAD")
    @ManyToOne(fetch = FetchType.LAZY)
    private Ciudad fidCanCiudad;
    @OneToMany(mappedBy = "fidCanBanco", fetch = FetchType.LAZY)
    private List<TransaccionExternaWeb> transaccionExternaWebCollection;

    public Banco() {
    }

    public Banco(Long idBanco) {
        this.idBanco = idBanco;
    }

    public Long getIdBanco() {
        return idBanco;
    }

    public void setIdBanco(Long idBanco) {
        this.idBanco = idBanco;
    }

    public String getNombreBanco() {
        return nombreBanco;
    }

    public void setNombreBanco(String nombreBanco) {
        this.nombreBanco = nombreBanco;
    }

    public String getDescripcionBanco() {
        return descripcionBanco;
    }

    public void setDescripcionBanco(String descripcionBanco) {
        this.descripcionBanco = descripcionBanco;
    }

    public Ciudad getFidCanCiudad() {
        return fidCanCiudad;
    }

    public void setFidCanCiudad(Ciudad fidCanCiudad) {
        this.fidCanCiudad = fidCanCiudad;
    }

    public List<TransaccionExternaWeb> getTransaccionExternaWebCollection() {
        return transaccionExternaWebCollection;
    }

    public void setTransaccionExternaWebCollection(List<TransaccionExternaWeb> transaccionExternaWebCollection) {
        this.transaccionExternaWebCollection = transaccionExternaWebCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idBanco != null ? idBanco.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Banco)) {
            return false;
        }
        Banco other = (Banco) object;
        if ((this.idBanco == null && other.idBanco != null) || (this.idBanco != null && !this.idBanco.equals(other.idBanco))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.upn.sigemfi.can.be.Banco[idBanco=" + idBanco + "]";
    }

}
